<template>
  <div>
    我是home
    <button @click="add">todo增加num</button>
     <button>user增加num</button>
    <!-- {{ $store.state.todo.num }} -->
    {{ num }}
    {{ num2 }}
    <a-button type="primary">
      Primary
    </a-button>
    <a href="http://www.baidu.com">aaa</a>

    <!-- <a-icon type="step-forward" style="font-size:30px"/> -->
  </div>
</template>

<script>
import { mapState, mapMutations } from 'vuex'
export default {
  methods: {
    add(){
      // this.$store.commit('todo/addNum', 10)
      // this['todo/addNum'](20);
      this.addNum(50)
    },
    // ...mapMutations(['todo/addNum'])
    ...mapMutations('todo', ['addNum']),
   
  },
  mounted () {
    console.log(this.$store)
  },
  computed: {
    ...mapState({
      num: state => state.todo.num,
      num2: state => state.user.num
    })
  }
}
</script>

<style lang="scss" scoped>

</style>
